package org.izao;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by Administrator on 2015/1/20 0020.
 */
public class Protocol {

    public static String encode(int reqId, String route, JSONObject msg) {
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("reqId", reqId);
            jsonObject.put("route", route);
            jsonObject.put("msg", msg);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return new StringBuilder(jsonObject.toString()).append("\r\n").toString();
    }
}
